package com.thtfpc.stroke.screening.controller;


import com.thtfpc.stroke.screening.bean.MedSampleDistribute;
import com.thtfpc.stroke.screening.bean.comm.CommResponse;
import com.thtfpc.stroke.screening.model.LogInReq;
import com.thtfpc.stroke.screening.model.MedSampleQuery;
import com.thtfpc.stroke.screening.model.SampleDistributeReq;
import com.thtfpc.stroke.screening.service.SampleDistributeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping({"/screening/sample/api"})
public class SampleDistributeController {

    @Autowired
   private SampleDistributeService sampleDistributeService ;

    @ApiOperation(value = "随机分配样本(实验组,对照组)", notes = "随机分配样本(实验组,对照组)")
    @RequestMapping(value = {"/generateDistributeCode"}, method = {RequestMethod.POST})
    @ResponseBody
    public CommResponse<MedSampleDistribute> generateDistributeCode(@RequestBody SampleDistributeReq req){
        return new CommResponse<>(sampleDistributeService.generateDistributeCode(req));
    }



    @ApiOperation(value = "登录", notes = "登录")
    @RequestMapping(value = {"/login"}, method = {RequestMethod.POST})
    @ResponseBody
    public CommResponse login(@RequestBody LogInReq req){


        return  sampleDistributeService.login(req);
    }


    @ApiOperation(value = "获得列表", notes = "获得列表")
    @RequestMapping(value = {"/getListByHospitalName"}, method = {RequestMethod.POST})
    @ResponseBody
    public CommResponse getListByHospitalName(@RequestBody MedSampleQuery req){

        return new CommResponse( sampleDistributeService.getListByHospitalName(req));
    }


}
